package com.example.ticket.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.ticket.entity.Authority;
import com.example.ticket.entity.UserAuthority;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface AuthorityMapper extends BaseMapper<Authority> {

    @Select("select u.id,u.username,a.authority from t_user u,t_authority a,t_user_authority ua where ua.user_id=u.id and ua.authority_id=a.id ")
    public List<UserAuthority> AuthorityList();

    @Update("update t_user_authority set authority_id=2 where user_id=#{id}")
    public int ChangeAuthority(Integer id);
}
